using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.ComponentModel;
using System.Windows.Forms;
using System.Drawing.Imaging;
using System.Drawing.Drawing2D;
using System.Runtime.InteropServices;

namespace MKDS_Course_Editor.NKM
{
    public class NkmCpoiPoint
    {
        public NkmCpoiPoint(float X1, float Y1, float X2, float Y2)
        {
            this.X1 = X1;
            this.Y1 = Y1;
            this.X2 = X2;
            this.Y2 = Y2;
        }
        public void Render(PaintEventArgs e, float ScaleX, float ScaleY)
        {
            e.Graphics.FillEllipse(new SolidBrush(Color.DarkGreen), X1 * ScaleX - (5f / 2f) + e.ClipRectangle.Width / 2, Y1 * ScaleY - (5f / 2f) + e.ClipRectangle.Height / 2, 5, 5);
            e.Graphics.FillEllipse(new SolidBrush(Color.DarkGreen), X2 * ScaleX - (5f / 2f) + e.ClipRectangle.Width / 2, Y2 * ScaleY - (5f / 2f) + e.ClipRectangle.Height / 2, 5, 5);
            e.Graphics.DrawLine(new Pen(Color.FromArgb(220, Color.DarkGreen)) { Width = 2.5f}, X1 * ScaleX + e.ClipRectangle.Width / 2, Y1 * ScaleY + e.ClipRectangle.Height / 2, X2 * ScaleX + e.ClipRectangle.Width / 2, Y2 * ScaleY + e.ClipRectangle.Height / 2);
        }
        public float GetMinX1(float ScaleX, int Width)
        {
            return (X1 * ScaleX) - (5f / 2f) + (Width / 2f);
        }
        public float GetMaxX1(float ScaleX, int Width)
        {
            return (X1 * ScaleX) + (5f / 2f) + (Width / 2f);
        }
        public float GetMinY1(float ScaleY, int Height)
        {
            return (Y1 * ScaleY) - (5f / 2f) + (Height / 2f);
        }
        public float GetMaxY1(float ScaleY, int Height)
        {
            return (Y1 * ScaleY) + (5f / 2f) + (Height / 2f);
        }
        public float GetMinX2(float ScaleX, int Width)
        {
            return (X2 * ScaleX) - (5f / 2f) + (Width / 2f);
        }
        public float GetMaxX2(float ScaleX, int Width)
        {
            return (X2 * ScaleX) + (5f / 2f) + (Width / 2f);
        }
        public float GetMinY2(float ScaleY, int Height)
        {
            return (Y2 * ScaleY) - (5f / 2f) + (Height / 2f);
        }
        public float GetMaxY2(float ScaleY, int Height)
        {
            return (Y2 * ScaleY) + (5f / 2f) + (Height / 2f);
        }
        private float x1 = 0;
        [Category("Position")]
        public float X1
        {
            get { return x1; }
            set { x1 = value; }
        }
        private float y1 = 0;
        [Category("Position")]
        public float Y1
        {
            get { return y1; }
            set { y1 = value; }
        }
        private float x2 = 0;
        [Category("Position")]
        public float X2
        {
            get { return x2; }
            set { x2 = value; }
        }
        private float y2 = 0;
        [Category("Position")]
        public float Y2
        {
            get { return y2; }
            set { y2 = value; }
        }
    }
}
